package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 定活自转签约成功
 */
public class LiveOnRoSuccessPp extends BasePopupView {
    Unbinder bind;
    @BindView(R.id.switch_success_name)
    TextView switchSuccessName;
    @BindView(R.id.switch_success_usernum)
    TextView switchSuccessUsernum;
    @BindView(R.id.switch_success_usernmae)
    TextView switchSuccessUsernmae;
    @BindView(R.id.switch_success_dealtype)
    TextView switchSuccessDealtype;
    @BindView(R.id.switch_success_money)
    TextView switchSuccessMoney;
    @BindView(R.id.switch_success_okbtn)
    Button switchSuccessOkbtn;
    @BindView(R.id.p_namelayout)
    RelativeLayout pNamelayout;
    @BindView(R.id.deal_money_layout)
    RelativeLayout dealMoneyLayout;

    CallBackLivetoRoOk mCallBackLivetoRoOk;

    public LiveOnRoSuccessPp(@NonNull Context context, CallBackLivetoRoOk callBackLivetoRoOk) {
        super(context);
        mCallBackLivetoRoOk=callBackLivetoRoOk;
    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.switch_success_layout;
    }

    public void setmSwName(String mSwName) {
        this.mSwName = mSwName;
    }

    public void setmCardNum(String mCardNum) {
        this.mCardNum = mCardNum;
    }

    public void setmUserName(String mUserName) {
        this.mUserName = mUserName;
    }

    String mSwName;//交易名称
    String mCardNum;//卡号
    String mUserName;//用户名

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);
        pNamelayout.setVisibility(View.GONE);
        dealMoneyLayout.setVisibility(View.GONE);

        switchSuccessName.setText(mSwName);
        switchSuccessUsernum.setText(mCardNum);
        switchSuccessUsernmae.setText(mUserName);

    }

    @OnClick(R.id.switch_success_okbtn)
    public void onViewClicked() {
        mCallBackLivetoRoOk.LivetoRoOk();
    }

    public interface CallBackLivetoRoOk {
        void LivetoRoOk();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }
}
